<template>
  <div>
    <el-radio-group v-model="isCollapse" style="margin-bottom: 30px">
      <el-radio-button :label="false">展开</el-radio-button>
      <el-radio-button :label="true">收起</el-radio-button>
    </el-radio-group>
    <el-menu
      default-active="1-4-1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :collapse="isCollapse"
    >
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span slot="title">导航一</span>
        </template>
        <el-menu-item-group>
          <span slot="title">分组一</span>
          <!-- <el-menu-item index="1-1">选项1</el-menu-item> -->
          <!-- <el-menu-item index="1-2">选项2</el-menu-item> -->
          <el-menu-item index="1-1">
            <!-- <router-link to="/routerOne/routerTwo">二级路由出口1</router-link> -->
            <router-link :to="{name:'routerTwo',params:{useridkey:userid}}">二级路由出口1</router-link>
            <input type="text" v-model="userid">
          </el-menu-item>
          <el-menu-item index="1-2">
            <!-- <router-link to="/routerOne/routerTwo2">二级路由出口2</router-link> -->
            <router-link :to="{name:'routerTwo2',query:{useridkey:userid}}">二级路由出口2</router-link>
          </el-menu-item>
          <!--  -->
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>
<style>
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    /* min-height: 100px; */
  }
</style>

<script>
  export default {
    data() {
      return {
        isCollapse: true,
        userid:123
      };
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }
  }
</script>